<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.io.*, java.sql.*, java.util.*,LS.*, date.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html lang="UTF-8">
<style>
.selectTableItem:hover {
	background-color: black;
	color: white;
	cursor: pointer;
}

th,td {
	padding-bottom: 5px;
	padding-top: 5px;
}

h4,h1 {
	margin: 0px;
	padding: 0px;
}

th {
	height: 30px;
	border-right: 1px solid #e5e5e5;
	border-bottom: 1px solid #e5e5e5;
}

tr {
	border-bottom: 1px solid #e5e5e5;
}

table {
	width: 100%;
}

.category {
	width: 19.666666666666666666%;
}

.modelname {
	width: 19.666666666666666666%;
}

.no {
	width: 19.666666666666666666%;
}

.lendingdate {
	width: 15.5%;
}

.returndate {
	width: 15.5%;
}

.state {
	width: 10%;
}

#outerview {
	padding-top: 10px;
	margin-left: 0px;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#outerview {
	width: 100%;
	min-height: 600px;
	padding: 0px;
}

#middleview {
	width: 90%;
	height: 500px;
	margin: 20px auto 0px auto;
	left: 50%;
}

#innerview {
	width: 100%;
	height: 100%;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
</style>

<head>
<meta charset="utf-8">
<title>성공회대학교 기자재 대여 시스템</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- styles시트 -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="assets/css/docs.css" rel="stylesheet">

<script type="text/javascript"
	src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript" src="assets/smartPop/jquery.smartPop.js"></script>
<link rel="stylesheet" href=".assets/smartPop/jquery.smartPop.css" />

<script type="text/javascript">

	$(document).ready(init);

	function init() {
		tableRowClickEvent();
	}

	function tableRowClickEvent() {
		$('tr.selectTableItem').click(SPOpen);
	} 
 
 	function SPOpen() {
		$.smartPop.open({
			width : 900,
			height : 645,
			url : 'LSmartPop.do?model_name=' + $('#mName', this).text()
					+ "&item_name=" + $('#iName', this).text()
					+ "&lending_start_date=" + $('#sDate', this).text()
		});
	}

	function smartPopClose() {
		$.smartPop.close();
	}
</script>

</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar">
	<!-- 메뉴
    ================================================== -->
	<%
		if (session.getAttribute("user") == null) {
	%>
	<jsp:include page="/top.do"></jsp:include>
	<%
		} else {
			Users u = (Users) session.getAttribute("user");
			if (u.getUser_position().equalsIgnoreCase("S")) {
	%>
	<!-- 학생이 로그인 했을 경우 메뉴 -->
	<jsp:include page="/studenttop.do"></jsp:include>
	<%
		} else if (u.getUser_position().equalsIgnoreCase("P")) {
	%>
	<!-- 교수가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/teachertop.do"></jsp:include>
	<%
		} else {
	%>
	<!-- 관리자가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/managertop.do"></jsp:include>
	<%
		}
		}
	%>

	<!-- 게시판
    ================================================== -->
	<div style="text-align: center">
		<div class="marketing"
			style="margin-bottom: 30px; color: #000; text-align: left">
			<div class="container">
				<h3 style="margin: 10px; font-size: 35px;">
					<strong>대여 및 신청현황</strong>
				</h3>
			</div>
		</div>
	</div>
	<div class="container">
		<div id="outerview">
			<div id="middleview">
				<div id="innerview">
					<table class="tableview">
						<tr>
							<th class="category">품목</th>
							<th class="modelname">모델</th>
							<th class="no">일련번호</th>
							<th class="lendingdate">대여일</th>
							<th class="returndate">반납예정일</th>
							<th class="state">상태</th>
						</tr>
						<%
							List<vwIELU> list = (List<vwIELU>) request.getAttribute("selectVwIELUByUserId");
						%>

						<c:forEach var="myInfo" items="${selectVwILUAByUserId}">

							<tr class="selectTableItem" id=sample2>

								<td id="iName">${myInfo.getItem_name2()}</td>
								<td id="mName">${myInfo.getModel_name2()}</td>
								<td>${myInfo.getEquipment_id2()}</td>
								<td id="sDate"><fmt:formatDate pattern="yyyy년 MM월 dd일"
										value="${myInfo.lending_start_date}" /></td>
								<td><fmt:formatDate pattern="yyyy년 MM월 dd일"
										value="${myInfo.due_date}" /></td>
								<td>
								<c:if test="${myInfo.lending_R_E == 'L'}">
									<c:choose>
									  <c:when test="${ myInfo.permit != true }">대여 신청 승인 대기중</c:when>
									  <c:when test="${ myInfo.equipment_id == undefined }">대여 신청 승인 완료</c:when>
									  <c:otherwise>대여 중</c:otherwise>
									</c:choose>
								</c:if>
								
								<c:if test="${myInfo.lending_R_E == 'E'}">
									<c:choose>
									  <c:when test="${ myInfo.permit != true }">연장 신청 승인 대기중</c:when>
									  <c:otherwise>연장 신청 승인 완료</c:otherwise>
									</c:choose>
								</c:if>
								
								<c:if test="${myInfo.lending_R_E == 'R'}">예약</c:if>
								
								</td>
								<td>
									<form method="post">
										<input type="hidden" name="mName" value="${myInfo.model_name}">
									</form>
								</td>
							</tr>
							
						</c:forEach>

					</table>
				</div>
			</div>
		</div>
	</div>

	<!-- 꼬리말
    ================================================== -->
	<footer class="footer">
		<div class="container">
			<p>Copyright SKHU. Software Student.</p>
		</div>
	</footer>


	<!-- javascript -->
	<!-- 	<script src="../assets/js/jquery.js"></script> -->
</body>
</html>
